app.controller('btnCtrl', ['$scope', '$http', BtnController]);
function BtnController($scope, $http){
    console.log('------$scope.menuId1-----', $scope.menuId);
    console.log('------$scope.buttonArr1-----', $scope.buttonArr);

    $scope.bindBtn = function(event) {
        var datas = $scope.getSelectedRows();
        var t = this;
        switch(event){
            case 'event-to-add':
            {
                window.top.add_tab("运营公司备案 - 新增","/web/hr/thrOperateCompanyBeian/toAdd");
                break;
            }
            case 'event-to-addByCanvassApply':
            {
                window.top.add_tab("运营公司备案 - 调取","/web/hr/thrOperateCompanyBeian/toAddByCanvassApply");
                break;
            }
            case 'event-to-edit':
            {
                if(datas.length == 0) {
                    layer.alert('尚未选中数据');
                } else if(datas.length > 1) {
                    layer.alert('只能选中一行数据');
                } else {
                    var canvassApplyItemId = datas[0].canvassApplyItemId;//招商申请表子表
                    if(canvassApplyItemId==undefined || canvassApplyItemId==null || canvassApplyItemId==''){//若不是调取招商申请表子表
                        window.top.add_tab("运营公司备案编辑 - "+datas[0].bid,"/web/hr/thrOperateCompanyBeian/toEdit?bid="+datas[0].bid);
                    }else {
                        window.top.add_tab("运营公司备案编辑 - "+datas[0].bid,"/web/hr/thrOperateCompanyBeian/toEditByCanvassApply?bid="+datas[0].bid);
                    }
                }
                break;
            }
            case 'LAYTABLE_EXPORT_DATA':
            {
                $scope.doExport('/api/inter/thrOperateCompanyBeian/export');
                break;
            }
        };
    }
}

//表格双击
app.controller('dbClickCtrl', ['$scope', '$http', DbClickController]);
function DbClickController($scope, $http){
    $scope.doubleClick = function(data) {
        console.log('------data-----', data);
        var canvassApplyItemId = data.canvassApplyItemId;//招商申请表子表
        if(canvassApplyItemId==undefined || canvassApplyItemId==null || canvassApplyItemId==''){//若不是调取招商申请表子表
            window.top.add_tab("运营公司备案编辑 - "+data.bid,"/web/hr/thrOperateCompanyBeian/toEdit?bid="+data.bid);
        }else {
            window.top.add_tab("运营公司备案编辑 - "+data.bid,"/web/hr/thrOperateCompanyBeian/toEditByCanvassApply?bid="+data.bid);
        }
    }
}
